﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iTFF.WPF.LyricWikiService;

namespace iTFF.WPF.Model.Lyrics
{
    class LyricsWikiWebProvider
    {

        public LyricsModel FetchLyricsResults(string artist, string song)
        {
            if (string.IsNullOrEmpty(artist) || string.IsNullOrEmpty(song))
                return null;
            
            LyricWikiPortTypeClient client = new LyricWikiPortTypeClient();

            if (client.checkSongExists(artist, song))
            {
                LyricsResult r = client.getSong(artist, song);
                return new LyricsModel { Artist = r.artist, Lyrics = r.lyrics.Replace("\n", Environment.NewLine), Name = r.song };
            }
            else
                return null;
        }
    }
}
